package com.taimi.newdemo.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        if (!registry.hasMappingForPattern("/openvpn")) {
            String userDir = System.getProperty("user.dir");
            System.out.println(userDir);
            registry.addResourceHandler("/openvpn/**").addResourceLocations("file:resources/",
                    "file:" + userDir + "/");
        }
    }
}
